﻿/******************************************************************************
 *  Project:		Neddle Community Edition
 *  Filename:		User.cs
 *	Created By:     Kristopher Cargile <kristopher@neddle.org>
 *  Date Created:	March 24, 2011
 * ****************************************************************************
 * IMPORTANT GNU LICENSE INFORMATION. DO NOT REMOVE THIS SECTION!
 * 
 * Neddle :: Copyright (c) 2010-2012, Cargile Technology Group, LLC
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 ******************************************************************************/

using System;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace Neddle
{
    /// <summary>
    /// A Neddle user.
    /// </summary>
    [DataContract]
    [Serializable]
    [XmlRoot("user", Namespace = "http://neddle.org/user/v1")]
    public class User : DataObject
    {
        /// <summary>
        /// Gets or sets the user name.
        /// </summary>
        /// <value>The user name.</value>
        [DataMember]
        [XmlElement("userName", IsNullable = true)]
        public string UserName { get; set; }

        /// <summary>
        /// Gets or sets the user's title (e.g. 'Dr.', 'Mrs.').
        /// </summary>
        /// <value>The user's title.</value>
        [DataMember]
        [XmlElement("title", IsNullable = true)]
        public string Title { get; set; }

        /// <summary>
        /// Gets or sets the user's first name.
        /// </summary>
        /// <value>The first name.</value>
        [DataMember]
        [XmlElement("firstName", IsNullable = true)]
        public string FirstName { get; set; }

        /// <summary>
        /// Gets or sets the user's last name.
        /// </summary>
        /// <value>The last name.</value>
        [DataMember]
        [XmlElement("lastName", IsNullable = true)]
        public string LastName { get; set; }

        /// <summary>
        /// Gets the user's full name.
        /// </summary>
        /// <value>The full name.</value>
        [XmlIgnore]
        public string FullName { get { return string.Concat(Title, " ", FirstName, " ", LastName).Trim(); } }

        /// <summary>
        /// Gets or sets the user's email address.
        /// </summary>
        /// <value>The email address.</value>
        [DataMember]
        [XmlElement("emailAddress", IsNullable = true)]
        public string EmailAddress { get; set; }

        /// <summary>
        /// Gets or sets the user's type.
        /// </summary>
        /// <value>The type.</value>
        [DataMember]
        [XmlElement("userType", IsNullable = true)]
        public UserType Type { get; set; }

        /// <summary>
        /// Gets or sets the user's type id.
        /// </summary>
        /// <value>The type id.</value>
        [DataMember]
        [XmlIgnore]
        public int TypeId { get; set; }
    }
}
